package com.ssy.lingxi.member.merchant.controller.web;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.dataauth.annotation.member.MemberAuth;
import com.ssy.lingxi.member.merchant.model.vo.basic.request.ProvinceCodeVO;
import com.ssy.lingxi.member.merchant.model.vo.basic.request.UpperRelationIdVO;
import com.ssy.lingxi.member.merchant.model.vo.basic.response.CountryAreaCodeNameVO;
import com.ssy.lingxi.member.merchant.model.vo.validate.request.*;
import com.ssy.lingxi.member.merchant.model.vo.validate.response.*;
import com.ssy.lingxi.member.merchant.service.web.IMemberAbilityDepositService;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 会员能力 - 会员入库审核相关接口
 * @author 万宁
 * @version 2.0.0
 * @date 2021-05-25
 */
@RestController
@RequestMapping("/member/deposit")
public class MemberAbilityDepositController {
    @Resource
    private IMemberAbilityDepositService memberAbilityDepositService;

    /**
     * 获取会员审核入库各个步骤分页查询列表页面下拉框
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/page/conditions", method = RequestMethod.GET)
    public Wrapper<MemberDepositSearchConditionVO> getDepositPageConditions(@RequestHeader HttpHeaders headers) {
        return memberAbilityDepositService.getDepositPageConditions(headers);
    }

    /**
     * 分页查询“待审核入库资料”会员列表
     * @param headers Http头部新
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/verify/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDepositPageQueryVO>> pageToVerifyDepositoryDetail(@RequestHeader HttpHeaders headers, @Valid MemberDepositPageVO pageVO) {
        return memberAbilityDepositService.pageToVerifyDepositoryDetail(headers, pageVO);
    }

    /**
     * “待审核入库资料” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/verify/detail", method = RequestMethod.GET)
    public Wrapper<MemberToVerifyDepositDetailVO> getToVerifyDepositoryDetail(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityDepositService.getToVerifyDepositoryDetail(headers, idVO);
    }

    /**
     * “待审核入库资料” - 根据选择的上级会员查询省列表
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/verify/province", method = RequestMethod.GET)
    public Wrapper<List<CountryAreaCodeNameVO>> getProvinceList(@RequestHeader HttpHeaders headers, @Valid UpperRelationIdVO idVO) {
        return memberAbilityDepositService.getProvinceList(headers, idVO);
    }

    /**
     * “待审核入库资料” - 根据选择的上级会员查询省列表
     * @param headers Http头部信息
     * @param citiesVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/verify/city", method = RequestMethod.GET)
    public Wrapper<List<CountryAreaCodeNameVO>> getCityList(@RequestHeader HttpHeaders headers, @Valid MemberDepositGetCitiesVO citiesVO) {
        return memberAbilityDepositService.getCityList(headers, citiesVO);
    }

    /**
     * “待审核入库资料” - 审核会员
     * @param headers Http头部信息
     * @param depositVO 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/verify", method = RequestMethod.POST)
    public Wrapper<Void> toVerifyDepositoryDetail(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberToVerifyDepositVO depositVO) {
        return memberAbilityDepositService.toVerifyDepositoryDetail(headers, depositVO);
    }

    /**
     * “待审核入库资料” - 批量审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/verify/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchVerifyDepositoryDetail(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateIdsVO idVO) {
        return memberAbilityDepositService.batchVerifyDepositoryDetail(headers, idVO);
    }

    /**
     * 分页查询“待审核入库资质”会员列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/qualify/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDepositPageQueryVO>> pageToVerifyDepositoryQualification(@RequestHeader HttpHeaders headers, @Valid MemberDepositPageVO pageVO) {
        return memberAbilityDepositService.pageToVerifyDepositoryQualification(headers, pageVO);
    }

    /**
     * “待审核入库资质” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/qualify/detail", method = RequestMethod.GET)
    public Wrapper<MemberDepositDetailVO> getToVerifyDepositoryQualification(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityDepositService.getToVerifyDepositoryQualification(headers, idVO);
    }

    /**
     * “待审核入库资质” - 审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/qualify", method = RequestMethod.POST)
    public Wrapper<Void> toVerifyDepositoryQualification(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateAgreeVO idVO) {
        return memberAbilityDepositService.toVerifyDepositoryQualification(headers, idVO);
    }

    /**
     * “待审核入库资质” - 批量审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/qualify/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchVerifyDepositoryQualifications(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateIdsVO idVO) {
        return memberAbilityDepositService.batchVerifyDepositoryQualifications(headers, idVO);
    }

    /**
     * 分页查询“待入库考察”会员列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/inspect/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDepositPageQueryVO>> pageToInspectDepository(@RequestHeader HttpHeaders headers, @Valid MemberDepositPageVO pageVO) {
        return memberAbilityDepositService.pageToInspectDepository(headers, pageVO);
    }

    /**
     * “待入库考察” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/inspect/detail", method = RequestMethod.GET)
    public Wrapper<MemberDepositDetailVO> getToInspectDepository(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityDepositService.getToInspectDepository(headers, idVO);
    }

    /**
     * “待入库考察” - 审核
     * @param headers Http头部信息
     * @param depositVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/inspect", method = RequestMethod.POST)
    public Wrapper<Void> toInspectDepository(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberToInspectDepositVO depositVO) {
        return memberAbilityDepositService.toInspectDepository(headers, depositVO);
    }

    /**
     * 分页查询“待入库分类”会员列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/classify/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDepositPageQueryVO>> pageToClassifyDepository(@RequestHeader HttpHeaders headers, @Valid MemberDepositPageVO pageVO) {
        return memberAbilityDepositService.pageToClassifyDepository(headers, pageVO);
    }

    /**
     * “待入库分类” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/classify/detail", method = RequestMethod.GET)
    public Wrapper<MemberToClassifyDetailVO> getToClassifyDepository(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityDepositService.getToClassifyDepository(headers, idVO);
    }

    /**
     * “待入库分类” - “适用区域”-省列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/classify/province", method = RequestMethod.GET)
    public Wrapper<List<CountryAreaCodeNameVO>> getToClassifyProvinces(@RequestHeader HttpHeaders headers) {
        return memberAbilityDepositService.getToClassifyProvinces(headers);
    }

    /**
     * “待入库分类” - “适用区域”-根据省编码查询市列表
     * @param headers Http头部信息
     * @param codeVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/classify/city", method = RequestMethod.GET)
    public Wrapper<List<CountryAreaCodeNameVO>> getToClassifyCities(@RequestHeader HttpHeaders headers, @Valid ProvinceCodeVO codeVO) {
        return memberAbilityDepositService.getToClassifyCities(headers, codeVO);
    }

    /**
     * “待入库分类” - 品类信息 - 查询结算方式，发票类型，币别，结算单据，付款方式
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/classify/category/items", method = RequestMethod.GET)
    public Wrapper<MemberClassifyCategoryItemVO> getToClassifyCategoryItems(@RequestHeader HttpHeaders headers) {
        return memberAbilityDepositService.getToClassifyCategoryItems(headers);
    }

    /**
     * “待入库分类” - 审核
     * @param headers Http头部信息
     * @param depositVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/classify", method = RequestMethod.POST)
    public Wrapper<Void> toClassifyDepository(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberToClassifyDepositVO depositVO) {
        return memberAbilityDepositService.toClassifyDepository(headers, depositVO);
    }

    /**
     * 分页查询“待审核入库(一级)”会员列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/grade/one/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDepositPageQueryVO>> pageToDepositGradeOne(@RequestHeader HttpHeaders headers, @Valid MemberDepositPageVO pageVO) {
        return memberAbilityDepositService.pageToDepositGradeOne(headers, pageVO);
    }

    /**
     * “待审核入库(一级)” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/one/detail", method = RequestMethod.GET)
    public Wrapper<MemberDepositGradeDetailVO> getToDepositGradeOne(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityDepositService.getToDepositGradeOne(headers, idVO);
    }

    /**
     * “待审核入库(一级)” - 审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/one", method = RequestMethod.POST)
    public Wrapper<Void> toDepositGradeOne(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateAgreeVO idVO) {
        return memberAbilityDepositService.toDepositGradeOne(headers, idVO);
    }

    /**
     * “待审核入库(一级)” - 批量审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/one/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchDepositGradeOne(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateIdsVO idVO) {
        return memberAbilityDepositService.batchDepositGradeOne(headers, idVO);
    }

    /**
     * 分页查询“待审核入库(二级)”会员列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/grade/two/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDepositPageQueryVO>> pageToDepositGradeTwo(@RequestHeader HttpHeaders headers, @Valid MemberDepositPageVO pageVO) {
        return memberAbilityDepositService.pageToDepositGradeTwo(headers, pageVO);
    }

    /**
     * “待审核入库(二级)” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/two/detail", method = RequestMethod.GET)
    public Wrapper<MemberDepositGradeDetailVO> getToDepositGradeTwo(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityDepositService.getToDepositGradeTwo(headers, idVO);
    }

    /**
     * “待审核入库(二级)” - 审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/two", method = RequestMethod.POST)
    public Wrapper<Void> toDepositGradeTwo(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateAgreeVO idVO) {
        return memberAbilityDepositService.toDepositGradeTwo(headers, idVO);
    }

    /**
     * “待审核入库(二级)” - 批量审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/grade/two/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchDepositGradeTwo(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateIdsVO idVO) {
        return memberAbilityDepositService.batchDepositGradeTwo(headers, idVO);
    }

    /**
     * 分页查询“待确认入库”会员列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @MemberAuth
    @RequestMapping(value = "/confirm/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberDepositPageQueryVO>> pageToConfirmDepository(@RequestHeader HttpHeaders headers, @Valid MemberDepositPageVO pageVO) {
        return memberAbilityDepositService.pageToConfirmDepository(headers, pageVO);
    }

    /**
     * “待确认入库” - 查询会员详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/confirm/detail", method = RequestMethod.GET)
    public Wrapper<MemberDepositGradeDetailVO> getToConfirmDepository(@RequestHeader HttpHeaders headers, @Valid ValidateIdVO idVO) {
        return memberAbilityDepositService.getToConfirmDepository(headers, idVO);
    }

    /**
     * “待确认入库” - 审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/confirm", method = RequestMethod.POST)
    public Wrapper<Void> toConfirmDepository(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateAgreeVO idVO) {
        return memberAbilityDepositService.toConfirmDepository(headers, idVO);
    }

    /**
     * “待确认入库” - 批量审核
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/confirm/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchConfirmDepositories(@RequestHeader HttpHeaders headers, @RequestBody @Valid ValidateIdsVO idVO) {
        return memberAbilityDepositService.batchConfirmDepositories(headers, idVO);
    }


}
